

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Create Columns [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Data Modeling,Data Modeling Create Columns,Column,Column Create In Data Modeling,Column Definition,Column In UML Data Modeling Profile,Column Order, Change,Column Stereotyped Attribute,Column Sequence Entries,Column Properties,Create,Create Columns In Data Modeling,Attribute,Attribute Stereotyped, For Columns,Oracle,Oracle Sequence">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Create Columns</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="set_oracle_table_options.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="create_oracle_packages.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_SubHeadingL1"><span class="f_SubHeadingL1">What is a Column?</span></p>
<p class="p_BodyText"><span class="f_BodyText">The basic organizational element of a relational database is the </span><span class="f_BodyText" style="font-style: italic;">column</span><span class="f_BodyText">. Every individual item of data entered into a relational database is represented as a value in a column of a row in a table. Columns are represented in the UML Data Modeling Profile as a stereotyped attribute; that is, an attribute with the </span><span class="f_BodyText" style="font-style: italic;">Column</span><span class="f_BodyText"> stereotype.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Create Columns</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="952" bgcolor="#efeff7" style="width:952px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Note:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="952" bgcolor="#f7f7ff" style="width:952px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">For MySQL, before creating columns first add ENUM and SET datatypes. Select the </span><span class="f_MenuKeyField">Settings | Database Datatypes</span><span class="f_TiporNoteText"> menu option and, on the </span><span class="f_UIControl">Database Datatypes</span><span class="f_TiporNoteText"> dialog, in the </span><span class="f_MenuKeyField">Product Name</span><span class="f_TiporNoteText"> field select </span><span class="f_MenuKeyField">MySQL</span><span class="f_TiporNoteText">. Add the datatypes ENUM and SET.</span></p>
</td>
</tr>
</table>
</div>
<p class="p_BodyText"><span class="f_BodyText">To create columns, follow the steps below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Right-click on the Table in a diagram to open the context menu, and select the </span><span class="f_MenuKeyField">Attributes</span><span class="f_NumberedList"> menu option.</span></li>
<li value=2><span class="f_NumberedList">The </span><span class="f_UIControl">&lt;Tablename&gt; Columns</span><span class="f_NumberedList"> dialog displays.</span><br>
<span class="f_NumberedList">&nbsp;</span><br>
<img src="tableattributesdialog.png" width="464" height="505" border="0" alt="TableAttributesDialog"><br>
<span class="f_NumberedList">&nbsp;</span></li>
<li value=3><span class="f_NumberedList">In the </span><span class="f_MenuKeyField">Name</span><span class="f_NumberedList"> field, type the column name.</span></li>
<li value=4><span class="f_NumberedList">In the </span><span class="f_MenuKeyField">Data Type</span><span class="f_NumberedList"> field, click on the drop-down arrow and select the data type, and click on the </span><span class="f_MenuKeyField">Save</span><span class="f_NumberedList"> button.</span></li>
</ol>
<div style="text-align: left; text-indent: -21px; padding: 0px 0px 0px 0px; margin: 5px 0px 0px 48px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="952" bgcolor="#efeff7" style="width:952px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Tip:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="952" bgcolor="#f7f7ff" style="width:952px; background-color:#f7f7ff;"><p class="p_TiporNoteText"><span class="f_TiporNoteText">If the drop-down list of datatypes is empty, this means that you have not selected a target database for the table. Close the </span><span class="f_UIControl">Columns</span><span class="f_TiporNoteText"> dialog and re-open the </span><span class="f_UIControl">Table Properties</span><span class="f_TiporNoteText"> dialog to set a database type before continuing. To prevent this recurring, <a href="o411.htm">set the default database type</a>.</span></p>
</td>
</tr>
</table>
</div>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=5><span class="f_NumberedList">The following fields for each column are optional:</span></li>
</ol>
<ul style="text-indent: 0px; margin-left: 65px; list-style-position: outside;">
<li><span class="f_MenuKeyField">Primary Key</span><span class="f_Bulletlist3"> - select the checkbox if the column represents the <a href="primarykey.htm">primary key</a> for this table</span></li>
<li><span class="f_MenuKeyField">Not Null</span><span class="f_Bulletlist3"> - select the checkbox if empty values are forbidden for this column</span></li>
<li><span class="f_MenuKeyField">Unique</span><span class="f_Bulletlist3"> - select the checkbox if it is forbidden for any two values of this column to be identical</span></li>
<li><span class="f_MenuKeyField">Initial </span><span class="f_Bulletlist3">- type a value that can be used as a default value for this column, if required</span></li>
<li><span class="f_MenuKeyField">Access</span><span class="f_Bulletlist3"> - click on the drop-down arrow and select a scope of </span><span class="f_MenuKeyField">Private</span><span class="f_Bulletlist3">, </span><span class="f_MenuKeyField">Protected</span><span class="f_Bulletlist3"> or </span><span class="f_MenuKeyField">Public</span><span class="f_Bulletlist3"> (the field defaults to </span><span class="f_MenuKeyField">Public</span><span class="f_Bulletlist3">)</span></li>
<li><span class="f_MenuKeyField">Alias </span><span class="f_Bulletlist3">- type an alternative name for the field (for display purposes), if any</span></li>
<li><span class="f_MenuKeyField">Notes</span><span class="f_Bulletlist3"> - type any other information necessary to document the column; you can format the text using the </span><span class="f_UIControl"><a href="rich_text_notes_toolbar.htm">Rich Text Notes toolbar</a></span><span class="f_Bulletlist3"> at the top of the field.</span></li>
</ul>
<div style="text-align: left; text-indent: -21px; padding: 0px 0px 0px 0px; margin: 5px 0px 0px 48px;"><table cellspacing="0" cellpadding="2" border="0" style="border: none; border-spacing:0px;">
<tr style="text-align:left;vertical-align:bottom;">
<td valign="bottom" width="952" bgcolor="#efeff7" style="width:952px; background-color:#efeff7;"><p class="p_TiporNote" style="border-top: none; border-right: none; border-left: none;"><span class="f_TiporNote">Notes:</span></p>
</td>
</tr>
<tr style="text-align:left;">
<td width="952" bgcolor="#f7f7ff" style="width:952px; background-color:#f7f7ff;"><ul style="text-indent: 0px; margin-left: 14px; list-style-position: outside;">
<li><span class="f_TiporNoteText">Some datatypes, such as the Oracle NUMBER type, require a precision and scale. These fields are displayed where required and should be filled in as appropriate. For example, for Oracle:</span><br>
<span class="f_TiporNoteText">&nbsp;</span><br>
<span class="f_TiporNoteText">create NUMBER by setting Precision = </span><span class="f_TiporNoteText" style="font-weight: bold;">0</span><span class="f_TiporNoteText"> and Scale = </span><span class="f_TiporNoteText" style="font-weight: bold;">0</span><br>
<span class="f_TiporNoteText">create NUMBER(8) by setting Precision = </span><span class="f_TiporNoteText" style="font-weight: bold;">8</span><span class="f_TiporNoteText"> and Scale = </span><span class="f_TiporNoteText" style="font-weight: bold;">0</span><br>
<span class="f_TiporNoteText">create NUMBER(8,2) by setting Precision = </span><span class="f_TiporNoteText" style="font-weight: bold;">8</span><span class="f_TiporNoteText"> and Scale = </span><span class="f_TiporNoteText" style="font-weight: bold;">2</span><span class="f_TiporNoteText">.</span></li>
</ul>
<ul style="text-indent: 0px; margin-left: 14px; list-style-position: outside;">
<li><span class="f_TiporNoteText">Oracle VARCHAR2(15 CHAR) and VARCHAR2(50 BYTE) datatypes can be created by adding the tag </span><span class="f_TiporNoteText" style="font-style: italic;">LengthType</span><span class="f_TiporNoteText"> with the value </span><span class="f_TiporNoteText" style="font-weight: bold;">CHAR</span><span class="f_TiporNoteText"> or </span><span class="f_TiporNoteText" style="font-weight: bold;">BYTE</span><span class="f_TiporNoteText">.</span></li>
<li><span class="f_TiporNoteText">For MySQL ENUM and SET datatypes, in the</span><span class="f_MenuKeyField"> Initial</span><span class="f_TiporNoteText"> field type the values as a comma-separated list, in the format </span><span class="f_TiporNoteText" style="font-style: italic;">('one','two','three'</span><span class="f_TiporNoteText">) or, if one value is the default, in the format: </span><span class="f_TiporNoteText" style="font-style: italic;">('one','two','three') default 'three'</span><span class="f_TiporNoteText">.</span></li>
</ul>
</td>
</tr>
</table>
</div>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=5><span class="f_NumberedList">Click on the </span><span class="f_MenuKeyField">Column Properties</span><span class="f_NumberedList"> button. The </span><span class="f_UIControl">Database Columns Properties</span><span class="f_NumberedList"> dialog displays. </span><br>
<span class="f_NumberedList">&nbsp;</span><br>
<img src="columnpropdial.png" width="317" height="297" border="0" alt="ColumnPropDial"><br>
<span class="f_NumberedList">&nbsp;</span><br>
<span class="f_NumberedList">If you require a sequence, such as an Oracle sequence, select the </span><span class="f_MenuKeyField">AutoNum</span><span class="f_NumberedList"> property, set the value to </span><span class="f_MenuKeyField">True</span><span class="f_NumberedList"> and, if necessary, define the start number and increment. Click on the </span><span class="f_MenuKeyField">OK</span><span class="f_NumberedList"> button to return to the </span><span class="f_UIControl">&lt;Tablename&gt; Columns</span><span class="f_NumberedList"> dialog.</span></li>
<li value=6><span class="f_NumberedList">Click on the </span><span class="f_MenuKeyField">Save</span><span class="f_NumberedList"> button and on either the </span><span class="f_MenuKeyField">New</span><span class="f_NumberedList"> button to define another column or the </span><span class="f_MenuKeyField">Close</span><span class="f_NumberedList"> button to exit from the dialog. </span></li>
</ol>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Change the Column Order</span></p>
<p class="p_BodyText"><span class="f_BodyText">To change the column order, follow the steps below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">On the </span><span class="f_UIControl">Columns</span><span class="f_NumberedList"> dialog, highlight a column name in the </span><span class="f_UIControl">Columns</span><span class="f_NumberedList"> panel.</span></li>
<li value=2><span class="f_NumberedList">Click on the:</span></li>
</ol>
<ul style="text-indent: 0px; margin-left: 65px; list-style-position: outside;">
<li><img src="uphand.png" width="27" height="24" border="0" alt="uphand"><span class="f_Bulletlist3"> button to move the column up one position</span></li>
<li><img src="downhand.png" width="27" height="24" border="0" alt="downhand"><span class="f_Bulletlist3"> button to move the column down one position.</span></li>
</ul>




            </div>
          </div>
        </div>



</div>


</body>
</html>
